[#ftl]
<#include "/layout/header.ftl" />
<#import "/include/ui.ftl" as blue />

<script>

$(function()
{
	
});

function save_click()
{
	$.simpleValid("#div_form", function(obj)
	{
		$.simpleAjax("/${module}/${view}_save", obj, function(o)
		{
			$.successAlert("保存成功", "save_success()", 2000);
		});
	});
}
function save_success()
{
	window.location = "${r"${path}"}/${module}/${view}_list${r"${ext}"}";	
}
</script>

<div class="am-form am-form-horizontal am-cf am-margin" id="div_form">
<input type="hidden" name="id" value="${r"${model.id!}"}"/>

	<fieldset>
		<legend><#if model.id??>修改<#else>添加</#if>${field}</legend>
		[#if columnList??]
		[#list columnList as vo]
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">代码</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="${vo.field}" placeholder="输入${field}" class="am-form-field am-radius"
						maxlength="${vo.size!"10"}" value="${r"${vo."}${vo.field}${r"!}"}" [#if !vo.nullable]required[/#if]/>
				</div>
			</div>
		</div>
		[/#list]
		[/#if]

		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">状态</label>
				<div class="am-u-md-9 am-u-end">
					<select class="am-form-field am-radius" id="slt_state" name="state" data-am-selected="{'btnWidth': '120px'}" required>
						<@blue.select list=map.state value=model.state!"0" />
					</select>
				</div>
			</div>
		</div>

		<div class="am-u-md-12 am-text-center div_btn">
			<a href="javascript:void(0)" onclick="save_click()" class="am-btn am-btn-primary am-radius">保存</a>
			<a href="javascript:void(0)" onclick="save_success()" class="am-btn am-btn-default am-radius am-margin-left">返回</a>
		</div>
	</fieldset>
</div>

<#include "/layout/footer.ftl" />